package agriculture.bean;

import agriculture.system.api.model.User;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("product_comment")
public class Comment {
    private Long id;
    private Long productId;
    private Long userId;
    private String content;
    private double rating;
    private int isDeleted;
    private int status;
    private String img;

    // 新增字段，不存数据库，仅用于返回数组格式给前端
    @TableField(exist = false)
    private List<String> imgList;

    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    // 添加一个 User 属性用于存储用户信息
    private User user;

    @Data
    public static class User{
        private Long id;
        private String username;
        private String avatar;
    }
}
